//package com.ymatou.paymentproxy.testcase;
//
//import java.util.ArrayList;
//import java.util.List;
//
//import org.junit.After;
//import org.junit.AfterClass;
//import org.junit.Before;
//import org.junit.BeforeClass;
//import org.junit.Test;
//import org.junit.experimental.categories.Category;
//
//import com.ymatou.paymentproxy.parameter.AcquireOrderBean;
//import com.ymatou.paymentproxy.parameter.CheckRefundableBean;
//import com.ymatou.paymentproxy.parameter.Detail;
//import com.ymatou.paymentproxy.parameter.SubmitRefundBean;
//import com.ymatou.paymentproxy.service.CheckRefundableCall;
//import com.ymt.core.tool.Logger;
//import com.ymt.utils.annotation.TestCase;
//import com.ymt.utils.annotation.TestSuite;
//import com.ymt.utils.tag.P1;
//import com.ymt.utils.tag.P2;
//import com.ymt.utils.tag.P3;
//import com.ymttest.business.service.PaymentProxyCallService;
//import com.ymttest.database.model.PPPayment;
///**
//*检查是否可以退款接口
//*FreeMaker Template自动生成代码
//*/
//@TestSuite
//public class Ts_CheckRefundable{
//	private static CheckRefundableBean checkrefundableBean;
//	private static CheckRefundableCall checkrefundableCall;
//	@BeforeClass
//	public static void setUp() {
//		Logger.createResultFile("检查是否可以退款接口");
//	}
//
//	@Before
//	public void caseUp() {
//		checkrefundableBean=new CheckRefundableBean();
//		checkrefundableCall=new CheckRefundableCall();
//	}
//
//	@AfterClass
//	public static void tearDown() {
//		Logger.generateResult(checkrefundableCall.getOpurl());
//	}
//
//	@After
//	public void caseDown() {
//		Logger.end();
//	}
//	@Test
//	@Category({P1.class})
//	@TestCase
//	public void Tc_CheckRefundable_001() {
//		Logger.start(true,"输入可以退款TradeNos检查是否可以退款成功");
//		try {
//			AcquireOrderBean aqb = PaymentProxyCallService.initAcquireOrder("10");
//			PaymentProxyCallService.acquireOrder(aqb);
//			PaymentProxyCallService.notifyCall(aqb);
//			SubmitRefundBean srb = PaymentProxyCallService.submitRefund(aqb);
//			List<String> TradeNos=new ArrayList<String>();
//			TradeNos.add(aqb.getOrderId());
//			checkrefundableBean.setTradeNos(TradeNos);
//			checkrefundableCall.setData(checkrefundableBean);
//			checkrefundableCall.callService();
//			Logger.verifyEquals("0", checkrefundableCall.getString("ErrorCode"), "验证ErrorCode");
//			ArrayList<Detail> list = checkrefundableCall.getDetails();
//			if(list.size()==1){
//				Detail d=list.get(0);
//				Logger.verifyEquals(srb.getTradeDetails().get(0).getTradeNo(), d.getTradeNo(), "验证TradeNo");
//				Logger.verifyEquals(new Double(aqb.getPayPrice()), new Double(d.getPayAmount().toString()), "验证PayAmount");
//				Logger.verifyEquals(aqb.getCurrency(), d.getCurrencyType(), "验证CurrencyType");
//				PPPayment pp = PaymentProxyCallService.getPPayment(aqb);
//				Logger.verifyEquals(pp.getPaymentId(), d.getPaymentId(), "验证PaymentId");
//				Logger.verifyEquals(true, d.getIsRefundable(), "验证IsRefundable");
//			}
//		} catch (Exception e) {
//			Logger.fail(e);
//		}
//	}
//	@Test
//	@Category({P3.class})
//	@TestCase
//	public void Tc_CheckRefundable_002() {
//		Logger.start(true,"不输入TradeNos审核退款失败");
//		try {
//			AcquireOrderBean aqb = PaymentProxyCallService.initAcquireOrder("10");
//			PaymentProxyCallService.acquireOrder(aqb);
//			PaymentProxyCallService.notifyCall(aqb);
//			PaymentProxyCallService.submitRefund(aqb);
//			List<String> TradeNos=new ArrayList<String>();
//			TradeNos.add(aqb.getOrderId());
////			checkrefundableBean.setTradeNos(TradeNos);
//			checkrefundableCall.setData(checkrefundableBean);
//			checkrefundableCall.callService();			
//			
//		} catch (Exception e) {
//			Logger.fail(e);
//		}
//	}
//	@Test
//	@Category({P2.class})
//	@TestCase
//	public void Tc_CheckRefundable_003() {
//		Logger.start(true,"输入不可以退款TradeNos检查是否可以退款成功");
//		try {
//			AcquireOrderBean aqb = PaymentProxyCallService.initAcquireOrder("10");
//			PaymentProxyCallService.acquireOrder(aqb);
//			PaymentProxyCallService.notifyCall(aqb);
//			PaymentProxyCallService.submitRefund(aqb);
//			List<String> TradeNos=new ArrayList<String>();
//			TradeNos.add(aqb.getOrderId()+123);
//			checkrefundableBean.setTradeNos(TradeNos);
//			checkrefundableCall.setData(checkrefundableBean);
//			checkrefundableCall.callService();				
//			
//		} catch (Exception e) {
//			Logger.fail(e);
//		}
//	}
//}